home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 / Aminet - June 1993 [Walnut Creek].iso / ab20 / languags / ada / adaed10a.lzh / Ada / Examples / Bench / benchdhry.lis < prev    next >
Encoding:
File List  |  1992-03-07  |  22.9 KB  |  603 lines

  1. NYU Ada/ED-C 1.7.3  Amiga OS 1.3     Sat   7 Mar 1992  11:17:10  PAGE    1
  2.  
  3.  
  4.    1:   -------------------------------------------------------------------------------
  5.    2:   --                                                                           --
  6.    3:   --                   "DHRYSTONE" Benchmark Program                           --
  7.    4:   --                  --------------------------------                         --
  8.    5:   --                                                                           --
  9.    6:   --     Version: ADA/1                                                        --
  10.    7:   --                                                                           --
  11.    8:   --     Date:    04/15/84                                                     --
  12.    9:   --                                                                           --
  13.   10:   --     Author:  Reinhold P. Weicker                                          --
  14.   11:   --                                         --
  15.   12:   --     Filename:  DHRYADAA.DEC                             --
  16.   13:   --                                         --
  17.   14:   --     History:                                     --
  18.   15:   --                                         --
  19.   16:   --       CHANGE MADE                 BY WHOM               DATE             --
  20.   17:   --     -----------            ---------              -------           --
  21.   18:   --                                                                           --
  22.   19:   --       added timing calls         D. Sayon           13 Feb 85         --
  23.   20:   --        to write to file                                                   --
  24.   21:   --                                                                           --
  25.   22:   -------------------------------------------------------------------------------
  26.   23:   --                                                                           --
  27.   24:   --  The following program contains statements of a high-level programming    --
  28.   25:   --  language (Ada) in a distribution considered representative:              --
  29.   26:   --                                                                           --
  30.   27:   --    assignments                53%                                         --
  31.   28:   --    control statements         32%                                         --
  32.   29:   --    procedure, function calls  15%                                         --
  33.   30:   
  34.   31:   --                                                                           --
  35.   32:   --  100 statements are dynamically executed.  The program is balanced with   --
  36.   33:   --  respect to the three aspects:                                            --
  37.   34:   --                                                                           --
  38.   35:   --    -statement type                                                        --
  39.   36:   --    -operand type (for simple data types)                                  --
  40.   37:   --    -operand access                                                        --
  41.   38:   --        operand global, local, parameter, or constant.                     --
  42.   39:   --                                                                           --
  43.   40:   --  The combination of these three aspects is balanced only approximately.   --
  44.   41:   --                                                                           --
  45.   42:   --  The program does not compute anything meaningful, but it is syntacially  --
  46.   43:   --  and semantically correct.  All variables have a value assigned to them   --
  47.   44:   --  before they are used as a source operand.                                --
  48.   45:   -------------------------------------------------------------------------------
  49.   46:   package Global_Def is
  50.   47:   ------------------
  51.   48:   --  Global type definitions
  52.   49:   
  53.   50:   type Enumeration is (Ident_1,Ident_2,Ident_3,Ident_4,Ident_5);
  54.   51:   
  55. NYU Ada/ED-C 1.7.3  Amiga OS 1.3     Sat   7 Mar 1992  11:17:10  PAGE    2
  56.  
  57.   52:   subtype One_To_Thirty is integer range 1..30;
  58.   53:   subtype One_To_Fifty is integer range 1..50;
  59.   54:   subtype Capital_Letter is character range 'A'..'Z';
  60.   55:   
  61.   56:   type String_30 is array(One_To_Thirty)of character;
  62.   57:     pragma Pack(String_30);
  63.                  <------------>
  64. * WARNING: Pragma PACK is ignored
  65.  
  66.   58:   
  67.   59:   type Array_1_Dim_Integer is array(One_To_Fifty)of integer;
  68.   60:   type Array_2_Dim_Integer is array(One_To_Fifty,
  69.   61:                                     One_To_Fifty)of integer;
  70.   62:   
  71.   63:   type Record_Type(Discr:Enumeration := Ident_1);
  72.   64:   
  73.   65:   type Record_Pointer is access Record_Type;
  74.   66:   
  75.   67:   type Record_Type(Discr:Enumeration := Ident_1)is
  76.   68:       record
  77.   69:         Pointer_Comp:      Record_Pointer;
  78.   70:         case Discr is
  79.   71:         when Ident_1 =>     -- only this variant is used,
  80.   72:                             -- but in some cases discriminant
  81.   73:                             -- checks are necessary
  82.   74:   
  83.   75:           Enum_Comp:       Enumeration;
  84.   76:           Int_Comp:        One_To_Fifty;
  85.   77:           String_Comp:     String_30;
  86.   78:         when Ident_2 =>
  87.   79:           Enum_Comp_2:     Enumeration;
  88.   80:           String_Comp_2:   String_30;
  89.   81:         when others =>
  90.   82:           Char_Comp_1,
  91.   83:           Char_Comp_2:     character;
  92.   84:         end case;
  93.   85:       end record;
  94.   86:   
  95.   87:   end Global_Def;
  96.   88:   
  97.   89:     with Global_Def,Calendar;
  98.   90:     use Global_Def,Calendar;
  99.   91:   
  100.   92:   package Pack_1 is
  101.   93:   -------------
  102.   94:   
  103.   95:     procedure Proc_0(cycles: in integer; start_time, stop_time: out Float);
  104.   96:     procedure Proc_1(Pointer_Par_in:  in      Record_Pointer);
  105.   97:     procedure Proc_2(Int_Par_In_Out:  in out  One_To_Fifty);
  106.   98:     procedure Proc_3(Pointer_Par_Out: out     Record_Pointer);
  107.   99:   
  108.  100:     Int_Glob:        integer;
  109.  101:   
  110.  102:   end Pack_1;
  111. NYU Ada/ED-C 1.7.3  Amiga OS 1.3     Sat   7 Mar 1992  11:17:10  PAGE    3
  112.  
  113.  103:   
  114.  104:   with Global_Def;
  115.  105:   use Global_Def;
  116.  106:   
  117.  107:   package Pack_2 is
  118.  108:   --------------
  119.  109:   
  120.  110:     procedure Proc_6 (Enum_Par_In:         in      Enumeration;
  121.  111:                       Enum_Par_Out:        out     Enumeration);
  122.  112:     procedure Proc_7 (Int_Par_In_1,
  123.  113:                       Int_Par_In_2:        in      One_To_Fifty;
  124.  114:                       Int_Par_Out:         out     One_To_Fifty);
  125.  115:     procedure Proc_8 (Array_Par_In_Out_1:  in out  Array_1_Dim_Integer;
  126.  116:                       Array_Par_In_Out_2:  in out  Array_2_Dim_Integer;
  127.  117:                       Int_Par_In_1,
  128.  118:                       Int_Par_In_2:        in      integer);
  129.  119:     function Func_1  (Char_Par_In_1,
  130.  120:                       Char_Par_In_2:       in      Capital_Letter)
  131.  121:                                                    return Enumeration;
  132.  122:     function Func_2  (String_Par_In_1,
  133.  123:                       String_Par_In_2:     in      String_30)
  134.  124:                                                      return boolean;
  135.  125:   
  136.  126:   end Pack_2;      
  137.  127:   
  138.  128:   with Global_Def,Pack_1,Text_IO, Help_Tools;
  139.  129:   use Global_Def, Text_IO, Help_Tools; 
  140.  130:   
  141.  131:   procedure Dhryadaa is
  142.  132:   --------------
  143.  133:   
  144.  134:   package real_io is new float_io(float); 
  145.  135:   use real_io;
  146.  136:   
  147.  137:   package int_io is new integer_io(integer); 
  148.  138:   use int_io;
  149.  139:   
  150.  140:   filename:    string (1..13);
  151.  141:   
  152.  142:   int_rating,
  153.  143:   No_of_Cycles,
  154.  144:   No_of_Runs :    integer;
  155.  145:   
  156.  146:   mean_rating,
  157.  147:   rating,
  158.  148:   mean_time,
  159.  149:   elapsed_time,
  160.  150:   start_time,
  161.  151:   stop_time:    float;
  162.  152:   
  163.  153:   data_file:    file_type;
  164.  154:   
  165.  155:   begin
  166.  156:   
  167. NYU Ada/ED-C 1.7.3  Amiga OS 1.3     Sat   7 Mar 1992  11:17:10  PAGE    4
  168.  
  169.  157:    mean_time := 0.0;
  170.  158:    mean_rating := 0.0;
  171.  159:    No_of_Runs := 5;
  172.  160:   
  173.  161:    time_filename (filename);
  174.  162:    filename(1) := 'D';
  175.  163:    create (data_file,out_file,filename,"");
  176.  164:    
  177.  165:    read_environ(data_file);
  178.  166:   
  179.  167:    put("ADA Dhrystone Benchmark (DHRYADAA.DEC)"); new_line;
  180.  168:    put(data_file,"ADA Dhrystone Benchmark (DHRYADAA.DEC)");new_line(data_file); 
  181.  169:   
  182.  170:    for N in 1..No_of_Runs loop  
  183.  171:   
  184.  172:     No_of_Cycles := N*100;  
  185.  173:   
  186.  174:     Pack_1.Proc_0(No_of_Cycles,start_time,stop_time);
  187.  175:           -- Proc_0 is actually the main program, but it is part
  188.  176:                   -- of a package, and a program within a package can
  189.  177:                   -- not be designated as the Dhryadaa program for execution.
  190.  178:                   -- Therefore Proc_0 is activated by a call from "Dhryadaa".
  191.  179:   
  192.  180:   --
  193.  181:   --  WRITE OUT TIMING RESULTS
  194.  182:   --
  195.  183:   --
  196.  184:   --  write out start time
  197.  185:   --
  198.  186:   
  199.  187:     new_line; put (" Dhrystone start time: ");put (start_time, 5, 2, 0);
  200.  188:     put (" seconds"); new_line;
  201.  189:     new_line(data_file); put (data_file," Dhrystone start time: ");
  202.  190:     put (data_file,start_time, 5, 2, 0);
  203.  191:     put (data_file," seconds"); new_line(data_file);
  204.  192:   
  205.  193:   --
  206.  194:   --  write out stop time
  207.  195:   --
  208.  196:   
  209.  197:     put (" Dhrystone stop time: ");put (stop_time, 5, 2, 0);
  210.  198:     put (" seconds");new_line; 
  211.  199:     put (data_file," Dhrystone stop time: ");
  212.  200:     put (data_file,stop_time, 5, 2, 0);
  213.  201:     put (data_file," seconds");
  214.  202:     new_line(data_file);
  215.  203:   
  216.  204:   --
  217.  205:   --  write out elapsed time
  218.  206:   --
  219.  207:   
  220.  208:     elapsed_time := stop_time - start_time;
  221.  209:     put (" Elapsed time for ");put (no_of_cycles, 3);
  222.  210:     put (" cycles: ");put(elapsed_time, 5,2,0); put(" seconds ");
  223. NYU Ada/ED-C 1.7.3  Amiga OS 1.3     Sat   7 Mar 1992  11:17:10  PAGE    5
  224.  
  225.  211:     new_line;
  226.  212:     put (data_file," Elapsed time for ");
  227.  213:     put (data_file,no_of_cycles, 3);
  228.  214:     put (data_file," cycles: ");put(data_file,elapsed_time, 5,2,0); 
  229.  215:     put (data_file," seconds ");
  230.  216:     new_line(data_file);
  231.  217:   
  232.  218:   --
  233.  219:   --  Sum the time in millisecs per cycle 
  234.  220:   --
  235.  221:   
  236.  222:     mean_time := mean_time + (elapsed_time*1000.0)/float(no_of_cycles);
  237.  223:   
  238.  224:   --
  239.  225:   --  Compute the Dhrystone rating based on the time for the number
  240.  226:   --    of cycles just executed and write 
  241.  227:   --
  242.  228:   --   RATING =  (100 statements/cycle * number of cycles)/elapsed time
  243.  229:   --
  244.  230:   
  245.  231:     rating := (100.0*FLOAT(NO_OF_CYCLES))/ELAPSED_TIME;
  246.  232:   
  247.  233:   --
  248.  234:   --  Sum Dhrystone rating
  249.  235:   --
  250.  236:   
  251.  237:     mean_rating := mean_rating + rating;
  252.  238:     int_rating := integer(rating);
  253.  239:     put (" Dhrystone rating:  "); put(int_rating);
  254.  240:     put (" statement execution per unit time "); new_line;
  255.  241:     put(data_file," Dhrystone rating:  ");
  256.  242:     put(data_file, int_rating);
  257.  243:     put(data_file," statement execution per unit time ");
  258.  244:     new_line(data_file);
  259.  245:   
  260.  246:    end loop;
  261.  247:   
  262.  248:   --
  263.  249:   --  Calculate the average time in millisecs per cycle
  264.  250:   --
  265.  251:   
  266.  252:    mean_time := mean_time/float(no_of_runs);
  267.  253:    new_line; put (" Average time per cycle: "); put (mean_time,5,2,0);
  268.  254:    put_line (" millisecs ");
  269.  255:    new_line (data_file);
  270.  256:    put (data_file," Average time per cycle: "); put (data_file,mean_time,5,2,0);
  271.  257:    put (data_file," millisecs ");
  272.  258:   
  273.  259:   --
  274.  260:   --  Calculate the average Dhrystone ratings
  275.  261:   --
  276.  262:   
  277.  263:    mean_rating := mean_rating/float(no_of_runs);
  278.  264:    int_rating :=    integer(mean_rating);
  279. NYU Ada/ED-C 1.7.3  Amiga OS 1.3     Sat   7 Mar 1992  11:17:10  PAGE    6
  280.  
  281.  265:   
  282.  266:    new_line; put(" Average Dhrystone rating: ");
  283.  267:    put (int_rating);  put (" statement execution per unit time ");
  284.  268:    new_line(data_file); put (data_file," Average Dhrystone rating: ");
  285.  269:    put (data_file,int_rating);
  286.  270:    put (data_file," statement execution per unit time ");
  287.  271:   
  288.  272:    close (data_file);
  289.  273:   
  290.  274:   end Dhryadaa;
  291.  275:   
  292.  276:   with Global_Def,Calendar,Pack_2;
  293.  277:   use Global_Def,Calendar;
  294.  278:   
  295.  279:   package body Pack_1 is
  296.  280:   -----------
  297.  281:   
  298.  282:     Bool_Glob:         boolean;
  299.  283:     Char_Glob_1,
  300.  284:     Char_Glob_2:       character;
  301.  285:     Array_Glob_1:      Array_1_Dim_Integer;
  302.  286:     Array_Glob_2:      Array_2_Dim_Integer;
  303.  287:     Pointer_Glob,
  304.  288:     Pointer_Glob_Next: Record_Pointer;
  305.  289:   
  306.  290:     procedure Proc_4;
  307.  291:     procedure Proc_5;
  308.  292:   
  309.  293:   procedure Proc_0 (cycles: in integer;start_time,stop_time: out float)
  310.  294:   is
  311.  295:     Int_Loc_1,
  312.  296:     Int_Loc_2,
  313.  297:     Int_Loc_3:     One_To_Fifty;
  314.  298:     Char_Loc:      character;
  315.  299:     Enum_Loc:      Enumeration;
  316.  300:     String_Loc_1,
  317.  301:     String_Loc_2: String_30; 
  318.  302:   
  319.  303:   
  320.  304:   begin
  321.  305:     -- Initializations
  322.  306:   
  323.  307:     Pack_1.Pointer_Glob_Next := new Record_Type;
  324.  308:     Pack_1.Pointer_Glob := new Record_Type
  325.  309:                            '(
  326.  310:                            Pointer_Comp =>Pack_1.Pointer_Glob_Next,
  327.  311:                            Discr        =>Ident_1,
  328.  312:                            Enum_Comp    =>Ident_3,
  329.  313:                            Int_Comp     =>40,
  330.  314:                            String_Comp  =>"DHRYSTONE PROGRAM, SOME STRING"
  331.  315:                        );
  332.  316:     String_Loc_1 := "DHRYSTONE PROGRAM, 1'ST STRING";
  333.  317:   -----------------
  334.  318:   
  335. NYU Ada/ED-C 1.7.3  Amiga OS 1.3     Sat   7 Mar 1992  11:17:10  PAGE    7
  336.  
  337.  319:   -- Start timer --
  338.  320:   
  339.  321:      Start_Time := float (seconds (clock));
  340.  322:   -----------------
  341.  323:   for N in 1..cycles loop
  342.  324:     Proc_5;
  343.  325:     Proc_4;
  344.  326:       -- Char_Glob_1 = 'A',Char_Glob_2 = 'B',Bool_Glob = false
  345.  327:     Int_Loc_1 := 2;
  346.  328:     Int_Loc_2 := 3;
  347.  329:     String_Loc_2 := "DHRYSTONE PROGRAM, 2'ND STRING";
  348.  330:     Enum_Loc := Ident_2;
  349.  331:     Bool_Glob := not Pack_2.Func_2(String_Loc_1,String_Loc_2);
  350.  332:      -- Bool_Glob = true
  351.  333:     while Int_Loc_1 < Int_Loc_2 loop --loop body executed once
  352.  334:      Int_Loc_3 := 5 * Int_Loc_1 - Int_Loc_2;
  353.  335:        -- Int_Loc_3 = 7
  354.  336:      Pack_2.Proc_7 (Int_Loc_1,Int_Loc_2,Int_Loc_3);
  355.  337:        -- Int_Loc_3 = 7
  356.  338:      Int_Loc_1 := Int_Loc_1 + 1;
  357.  339:     end loop;
  358.  340:       -- Int_Loc_1 = 3
  359.  341:     Pack_2.Proc_8(Array_Glob_1,Array_Glob_2,Int_Loc_1,Int_Loc_3);
  360.  342:       -- Int_Glob = 5
  361.  343:     Proc_1 (Pointer_Glob);
  362.  344:     for Char_Index in 'A'..Char_Glob_2 loop --loop body executed twice
  363.  345:       if Enum_Loc=Pack_2.Func_1(Char_Index,'C')
  364.  346:       then--not executed
  365.  347:         Pack_2.Proc_6(Ident_1,Enum_Loc);
  366.  348:       end if;
  367.  349:     end loop;
  368.  350:       -- Enum_Loc = Ident_1
  369.  351:       -- Int_Loc_1 = 3,Int_Loc_2 = 3,Int_Loc_3 = 7
  370.  352:     Int_Loc_3 := Int_Loc_2 * Int_Loc_1;
  371.  353:     Int_Loc_2 := Int_Loc_3 / Int_Loc_1;
  372.  354:     Int_Loc_2 := 7 * (Int_Loc_3 - Int_Loc_2) - Int_Loc_1;
  373.  355:     Proc_2(Int_Loc_1);
  374.  356:   
  375.  357:   end loop;
  376.  358:   -----------------
  377.  359:   
  378.  360:   -- Stop timer --
  379.  361:   
  380.  362:      Stop_Time := float (seconds(clock));
  381.  363:   -----------------
  382.  364:   
  383.  365:   end Proc_0;
  384.  366:   
  385.  367:   procedure Proc_1 (Pointer_Par_In: in Record_Pointer)
  386.  368:   is--executed once
  387.  369:     Next_Record: Record_Type
  388.  370:       renames Pointer_Par_In.Pointer_Comp.all;--=Pointer_Glob_Next.all
  389.  371:   begin
  390.  372:     Next_Record := Pointer_Glob.all;
  391. NYU Ada/ED-C 1.7.3  Amiga OS 1.3     Sat   7 Mar 1992  11:17:10  PAGE    8
  392.  
  393.  373:     Pointer_Par_In.Int_Comp := 5;
  394.  374:     Next_Record.Int_Comp := Pointer_Par_In.Int_Comp;
  395.  375:     Next_Record.Pointer_Comp := Pointer_Par_In.Pointer_Comp;
  396.  376:     Proc_3 (Next_Record.Pointer_Comp);
  397.  377:       -- Next_Record.Pointer_Comp = Pointer_Glob.Pointer_Comp = Pointer_Glob_Next
  398.  378:     if Next_Record.Discr = Ident_1
  399.  379:     then -- executed
  400.  380:        Next_Record.Int_Comp := 6;
  401.  381:        Pack_2.Proc_6(Pointer_Par_In.Enum_Comp,Next_Record.Enum_Comp);
  402.  382:        Next_Record.Pointer_Comp := Pointer_Glob.Pointer_Comp;
  403.  383:        Pack_2.Proc_7(Next_Record.Int_Comp, 10, Next_Record.Int_Comp);
  404.  384:     else  -- not executed
  405.  385:        Pointer_Par_In.all := Next_Record;
  406.  386:     end if;
  407.  387:   end Proc_1;
  408.  388:   
  409.  389:   procedure Proc_2 (Int_Par_In_Out:in out One_To_Fifty)
  410.  390:   is -- executed once
  411.  391:      -- In_Par_In_Out = 3,becomes 7
  412.  392:     Int_Loc: One_To_Fifty;
  413.  393:     Enum_Loc: Enumeration;
  414.  394:   begin
  415.  395:     Int_Loc := Int_Par_In_Out + 10;
  416.  396:     loop -- executed once
  417.  397:       if Char_Glob_1 = 'A'
  418.  398:       then -- executed
  419.  399:         Int_Loc := Int_Loc - 1;
  420.  400:         Int_Par_In_Out := Int_Loc - Int_Glob;
  421.  401:         Enum_Loc := Ident_1;
  422.  402:       end if;
  423.  403:     exit when Enum_Loc = Ident_1; -- true
  424.  404:     end loop;
  425.  405:   end Proc_2;
  426.  406:   
  427.  407:   procedure Proc_3 (Pointer_Par_Out: out Record_Pointer)
  428.  408:   is -- executed once
  429.  409:      -- Pointer_Par_Out becomes Pointer_Glob
  430.  410:   begin
  431.  411:     if Pointer_Glob /= null
  432.  412:     then -- executed
  433.  413:       Pointer_Par_Out := Pointer_Glob.Pointer_Comp;
  434.  414:     else -- not executed
  435.  415:       Int_Glob := 100;
  436.  416:     end if;
  437.  417:     Pack_2.Proc_7(10,Int_Glob,Pointer_Glob.Int_Comp);
  438.  418:   end Proc_3;
  439.  419:   
  440.  420:   procedure Proc_4 -- without parameters
  441.  421:   is -- executed once
  442.  422:     Bool_Loc: boolean;
  443.  423:   begin
  444.  424:     Bool_Loc := Char_Glob_1 = 'A';
  445.  425:     Bool_Loc := Bool_Loc or Bool_Glob;
  446.  426:     Char_Glob_2 := 'B';
  447. NYU Ada/ED-C 1.7.3  Amiga OS 1.3     Sat   7 Mar 1992  11:17:10  PAGE    9
  448.  
  449.  427:   end Proc_4;
  450.  428:   
  451.  429:   procedure Proc_5 -- without parameters
  452.  430:   is--executed once
  453.  431:   begin
  454.  432:     Char_Glob_1 := 'A';
  455.  433:     Bool_Glob := false;
  456.  434:   end Proc_5;
  457.  435:   
  458.  436:   end Pack_1;
  459.  437:   
  460.  438:   with Global_Def,Pack_1;
  461.  439:   use Global_Def;
  462.  440:   
  463.  441:   package body Pack_2 is
  464.  442:   -------------------
  465.  443:   function Func_3(Enum_Par_In: in Enumeration)return boolean;
  466.  444:            -- forward declaration
  467.  445:   
  468.  446:   procedure Proc_6(Enum_Par_In:   in Enumeration;
  469.  447:                    Enum_Par_Out:  out Enumeration)
  470.  448:   is -- executed once
  471.  449:      -- Enum_Par_In = Ident_3,Enum_Par_Out becomes Ident_2
  472.  450:   begin
  473.  451:     Enum_Par_Out := Enum_Par_In;
  474.  452:     if not Func_3(Enum_Par_In)
  475.  453:     then -- not executed
  476.  454:       Enum_Par_Out := Ident_4;
  477.  455:     end if;
  478.  456:     case Enum_Par_In is
  479.  457:       when Ident_1 => Enum_Par_Out := Ident_1;
  480.  458:       when Ident_2 => if Pack_1.Int_Glob > 100
  481.  459:                       then Enum_Par_Out := Ident_1;
  482.  460:                       else Enum_Par_Out := Ident_4;
  483.  461:                       end if;
  484.  462:       when Ident_3 => Enum_Par_Out := Ident_2; -- executed
  485.  463:       when Ident_4 => null;
  486.  464:       when Ident_5 => Enum_Par_Out := Ident_3;
  487.  465:     end case;
  488.  466:   end Proc_6;
  489.  467:   procedure Proc_7(Int_Par_In_1,
  490.  468:                     Int_Par_In_2: in One_To_Fifty;
  491.  469:                     Int_Par_Out:  out One_To_Fifty)
  492.  470:   is -- executed three times
  493.  471:      -- first call:     Int_Par_In_1 = 2,Int_Par_In_2 = 3,
  494.  472:      --                 Int_Par_Out becomes 7
  495.  473:      -- second call:    Int_Par_In_1 = 6,Int_Par_In_2 = 10,
  496.  474:      --                 Int_Par_Out becomes 18
  497.  475:      -- third call:     Int_Par_In_1 = 10,Int_par_In_2 = 5,
  498.  476:      --                 Int_Par_Out becomes 17
  499.  477:     Int_Loc: One_To_Fifty;
  500.  478:   begin
  501.  479:     Int_Loc := Int_Par_In_1 + 2;
  502.  480:     Int_Par_Out := Int_Par_In_2 + Int_Loc;   
  503. NYU Ada/ED-C 1.7.3  Amiga OS 1.3     Sat   7 Mar 1992  11:17:10  PAGE    10
  504.  
  505.  481:   end Proc_7;
  506.  482:   procedure Proc_8 (Array_Par_In_Out_1:in out Array_1_Dim_Integer;
  507.  483:                     Array_Par_In_Out_2:in out Array_2_Dim_Integer;
  508.  484:                     Int_Par_In_1,
  509.  485:                     Int_Par_In_2:      in     integer)
  510.  486:   is -- executed once
  511.  487:      -- Int_Par_In_1 = 3
  512.  488:      -- Int_Par_In_2 = 7
  513.  489:     Int_Loc:One_To_Fifty;
  514.  490:   begin
  515.  491:     Int_Loc := Int_par_In_1 + 5;
  516.  492:     Array_Par_In_Out_1(Int_Loc) := Int_Par_In_2;
  517.  493:     Array_Par_In_Out_1(Int_Loc+1) :=
  518.  494:                            Array_Par_In_Out_1 (Int_Loc);
  519.  495:     Array_Par_In_Out_1(Int_Loc+30) := Int_Loc;
  520.  496:     for Int_Index in Int_Loc .. Int_Loc+1 loop -- loop body executed twice
  521.  497:       Array_Par_In_Out_2(Int_Loc,Int_Index) := Int_Loc;
  522.  498:     end loop;
  523.  499:     Array_Par_In_Out_2(Int_Loc,Int_Loc-1) :=
  524.  500:                            Array_Par_In_Out_2(Int_Loc,Int_Loc-1)+1;
  525.  501:     Array_Par_In_Out_2(Int_Loc+20,Int_Loc) :=
  526.  502:                            Array_Par_In_Out_1(Int_Loc);
  527.  503:     Pack_1.Int_Glob := 5;
  528.  504:   end Proc_8;
  529.  505:   function Func_1(Char_Par_In_1,
  530.  506:                   Char_Par_In_2:in Capital_Letter)
  531.  507:                                                  return Enumeration
  532.  508:   is -- executed three times, returns Ident_1 each time
  533.  509:      -- first call:  Char_Par_In_1 = 'H', Char_Par_In_2 = 'R'
  534.  510:      -- second call: Char_Par_In_1 = 'A', Char_Par_In_2 = 'C'
  535.  511:      -- third call:  Char_Par_In_1 = 'B', Char_Par_In_2 = 'C'
  536.  512:     Char_Loc_1,Char_Loc_2:Capital_Letter;
  537.  513:   begin
  538.  514:     Char_Loc_1 := Char_Par_In_1;
  539.  515:     Char_Loc_2 := Char_Loc_1;
  540.  516:     if Char_Loc_2 /= Char_Par_In_2
  541.  517:     then-- executed
  542.  518:       return Ident_1;
  543.  519:     else-- not executed
  544.  520:       return Ident_2;
  545.  521:     end if;
  546.  522:     end Func_1;
  547.  523:   function Func_2(String_Par_In_1,
  548.  524:                   String_Par_In_2:in String_30)return boolean
  549.  525:   is -- executed once, returns false
  550.  526:      -- String_Par_In_1 = "DHRYSTONE, 1'ST STRING"
  551.  527:      -- String_Par_In_2 = "DHRYSTONE, 2'ND STRING"
  552.  528:      Int_Loc:  One_To_Thirty;
  553.  529:      Char_Loc: Capital_Letter;
  554.  530:   begin
  555.  531:     Int_Loc := 2;
  556.  532:     while Int_Loc<=2 Loop -- loop body executed once
  557.  533:       if Func_1(String_Par_In_1(Int_Loc),
  558.  534:                 String_Par_In_2(Int_Loc+1)) = Ident_1
  559. NYU Ada/ED-C 1.7.3  Amiga OS 1.3     Sat   7 Mar 1992  11:17:10  PAGE    11
  560.  
  561.  535:       then-- executed
  562.  536:         Char_Loc := 'A';
  563.  537:         Int_Loc := Int_Loc + 1;
  564.  538:       end if;
  565.  539:   end loop;
  566.  540:   if Char_Loc >= 'W' and Char_Loc < 'Z'
  567.  541:   then-- not executed
  568.  542:      Int_Loc := 7;
  569.  543:   end if;
  570.  544:   if Char_Loc = 'X'
  571.  545:   then-- not executed
  572.  546:         return true;
  573.  547:       else -- executed
  574.  548:         if String_Par_In_1 > String_Par_In_2
  575.  549:         then -- not executed
  576.  550:           Int_Loc := Int_Loc + 7;
  577.  551:           return true;
  578.  552:       else -- executed
  579.  553:         return false;
  580.  554:       end if;
  581.  555:     end if;
  582.  556:   end Func_2;
  583.  557:   
  584.  558:   function Func_3(Enum_Par_In: in Enumeration)return boolean
  585.  559:   is -- executed once, returns true
  586.  560:      -- Enum_Par_In = Ident_3
  587.  561:     Enum_Loc: Enumeration;
  588.  562:   begin
  589.  563:     Enum_Loc := Enum_Par_In;
  590.  564:     if Enum_Loc = Ident_3
  591.  565:     then -- executed
  592.  566:       return true;
  593.  567:     end if;
  594.  568:   end Func_3;
  595.  569:   
  596.  570:   end Pack_2;
  597.  571:   
  598.  572:   
  599.  573:   
  600.  
  601.  
  602.     No errors detected
  603.